package xin.yangshuai.jackson01.controller;

import com.fasterxml.jackson.databind.ObjectMapper;
import xin.yangshuai.jackson01.entity.TestJackson;

import java.io.IOException;

/**
 * Hello
 *
 * @author shuai
 * @date 2021/11/10
 */
public class Hello {

    public static void main(String[] args) throws IOException {
        TestJackson testJackson = new TestJackson("123", "456", "789");

        ObjectMapper objectMapper = new ObjectMapper();
//        String s = objectMapper.writeValueAsString(testJackson);
//        System.out.println(s);
        String json = "{\"alpha\":\"alpha2\",\"beta\":\"beta2\",\"DD\":\"DD2\"}";
        TestJackson testJackson1 = objectMapper.readValue(json, TestJackson.class);
        System.out.println(testJackson1);
    }
}
